<template>
  <div class="hello">
    <div v-if="noticeBarShow" class="noticeBar">
      <Icon type="ios-alert-outline" custom="notice-icon" size="18" />
      <div class="notice-warp">
        <div>{{noticeBar}}</div>
      </div>
    </div>
    <h1 class="page-title">
      <span>新生信息查询</span>
    </h1>
    <p class="page-describe">青春在线提供技术支持</p>
    <router-view class="router-view"></router-view>
    <!-- <p class="copyright">Copyright @ 2019 青春在线</p> -->
    <div class="follow-us">
      服务由青春在线网站提供
      <Button type="success">
        <a :href="followUs">关注公众号</a>
      </Button>
    </div>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      noticeBar: null,
      noticeBarShow: false,
      followUs:
        "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MjM5NjM5NjkwMA==&scene=124#wechat_redirect"
    };
  },
  created() {
    this.$axios
      .get("https://youthapi.sdut.edu.cn/api/service/freshmanNotice")
      .then(result => {
        if (result.status === 200) {
          const data = result.data;
          if (data.code === 1) {
            this.noticeBarShow = true;
            this.noticeBar = data.msg;
          }
        }
      });
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.hello {
  height: 100vh;
}

.noticeBar {
  height: 40px;
  width: 100%;
  background-color: #fffbe8;
  padding: 0 16px;
  border-bottom: 1px solid rgb(221, 221, 221);
  position: fixed;
  top: 0;
  z-index: 99;
}

.notice-warp {
  color: #ed6a0c;
  line-height: 40px;
  font-size: 14px;
  overflow: hidden;
}

.notice-warp div {
  display: inline-block;
  padding-left: 108%;
  white-space: nowrap;
  transform: translateX(0%);
  animation: notice 10s linear 0s infinite normal;
}

.notice-icon {
  float: left;
  position: relative;
  top: 50%;
  margin-top: -9px;
  margin-right: 8px;
  color: #ed6a0c;
}

.page-title {
  margin: 0 0 5px;
  padding: 40px 10px 10px;
  text-align: center;
  font-size: 34px;
  font-weight: 400;
}
.page-title span {
  position: relative;
}
.page-title span::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: -10%;
  height: 2px;
  background-color: #008aff;
  -webkit-animation: blueline 0.3s ease 0.3s;
  animation: blueline 0.3s ease 0.3s;
  -webkit-animation-fill-mode: forwards;
  animation-fill-mode: forwards;
}

.page-describe {
  font-size: 12px;
  text-align: center;
  color: rgba(120, 120, 120, 0);
  -webkit-animation: describe 0.5s ease 0.5s;
  animation: describe 0.5s ease 0.5s;
  -webkit-animation-fill-mode: forwards;
  animation-fill-mode: forwards;
}

.router-view {
  padding-bottom: 66px;
}

.copyright {
  font-size: 12px;
  color: #666;
  text-align: center;
  padding-bottom: 10px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
}

.follow-us {
  font-size: 13px;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 46px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  box-shadow: 0 -1px 5px 0 rgba(146, 146, 146, 0.568);
  background-color: #f8f8f9;
}

.follow-us a {
  color: #f8f8f9;
}

@keyframes notice {
  from {
    transform: translateX(0%);
  }
  to {
    transform: translateX(-100%);
  }
}

@-webkit-keyframes blueline {
  from {
    width: 0;
  }
  to {
    width: 120%;
  }
}

@keyframes blueline {
  from {
    width: 0;
  }
  to {
    width: 120%;
  }
}

@-webkit-keyframes describe {
  from {
    transform: translateY(10px);
    color: rgba(120, 120, 120, 0);
  }
  to {
    transform: translateY(0px);
    color: rgba(120, 120, 120, 1);
  }
}

@keyframes describe {
  from {
    transform: translateY(10px);
    color: rgba(120, 120, 120, 0);
  }
  to {
    transform: translateY(0px);
    color: rgba(120, 120, 120, 1);
  }
}
</style>
